package com.example.demo4.controller;


import com.example.demo4.entity.Result;
import com.sun.javafx.collections.MappingChange;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@CrossOrigin
public class LoginController {
    @PostMapping("login")
     public Result login(@RequestBody Map<String,String> map){
     String username = map.get("username");
     String password = map.get("password");

        System.out.println("username:"+username+"---password:"+password);

     if(username.equals("1001")&&password.equals("123456")){
         System.out.println("登录成功");
         return new Result(0,null,"成功");
     }
     else {
         System.out.println("登录失败");
         System.out.println("登录失败");
         System.out.println("登录失败");
         return new Result(1,null,"失败");
     }
   }

}
